import { createStore } from "redux"
import createRootReduce from "./reducers/index"
import { createHashHistory } from 'history'
import { applyMiddleware } from "redux"
import { routerMiddleware } from "connected-react-router"
import createSagaMiddleware from "redux-saga"
import rootSaga from "./sagas"
import { composeWithDevTools } from "redux-devtools-extension"

export const history = createHashHistory()

const sagaMiddleware = createSagaMiddleware()

const store = createStore(
  createRootReduce(history),
  composeWithDevTools(applyMiddleware(routerMiddleware(history), sagaMiddleware))
)
sagaMiddleware.run(rootSaga)

export default store